package com.heyqing.ems.controller;

import cn.hutool.core.bean.BeanUtil;
import com.heyqing.ems.domain.ResignationManagement;
import com.heyqing.ems.po.QueryPo;
import com.heyqing.ems.po.ResignationPo;
import com.heyqing.ems.service.ResignationService;
import com.heyqing.ems.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:ResignationController
 * Package:com.heyqing.ems.controller
 * Description:
 *
 * @Date:2024/6/26
 * @Author:Heyqing
 */
@Api(value = "离职")
@RestController
@RequestMapping("rig")
@RequiredArgsConstructor
public class ResignationController {

    private final ResignationService resignationService;

    /**
     * 离职查询
     *
     * @param queryPo
     * @return
     */
    @ApiOperation("查询列表")
    @PostMapping("list")
    public Result list(@RequestBody QueryPo queryPo) {
        return resignationService.getList(queryPo);
    }

    /**
     * 同意离职
     *
     * @param id
     * @return
     */
    @ApiOperation("同意离职")
    @PutMapping("agree/{id}")
    public Result agree(@PathVariable Long id) {
        return resignationService.agree(id);
    }

    /**
     * 创建离职
     *
     * @param resignationPo
     * @return
     */
    @ApiOperation("创建离职")
    @PostMapping("create")
    public Result save(@RequestBody ResignationPo resignationPo) {
        return resignationService.saveResignation(resignationPo);
    }
    
}
